home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: transThreadDeath.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:56:03 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "io.h"
- #include "list.h"
- #include "tid.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "link.h"
- #include "lsn.h"
- #include "latch.h"
- #include "bf.h"
- #include "volume.h"
- #include "trans.h"
- #include "bitvec.h"
- #include "msgvector.h"
- #include "threadstate.h"
- #include "msg_funcs.h"
- #include "thread_funcs.h"
- #include "thread_globals.h"
- #include "msg_globals.h"
- #include "server_util_funcs.h"
-
- void
- transThreadDeath (
-
- register TCB *tcb
- )
- {
- TRACE(TR_MSG, TR_LEVEL_1);
-
- /*
- * check to see if this thread is running as part of a transaction
- */
- if (LIST_MEMBER( &(tcb->transList) )) {
- register TRANSREC *transRec;
-
- TRPRINT(TR_MSG|TR_TRANS, TR_LEVEL_2, ("transaction thread"));
-
- /*
- * get a pointer to the transaction record
- */
- transRec = (TRANSREC *) tcb->transRec;
- CHECK_TRANSREC_MAGIC(transRec);
-
- /*
- * remove it from the list and decrement count
- */
- listRemove( &(tcb->transList) );
- transRec->threadCount--;
- tcb->transRec = NULL;
-
- /*
- * If this thread is holding the transaction log semaphore,
- * then release the semaphore.
- */
- if (transRec->logSemaphore.holder == Active) {
- signalSemaphore(&(transRec->logSemaphore));
- }
-
- /*
- * if we are the last thread (ie. only master left) then we
- * must signal the master thread that completion is ready
- *
- * The master thread is not on the transaction thread
- * list, so it does not add one to the threadCount.
- */
- if (transRec->transState == T_QUIESCE && transRec->threadCount == 0) {
-
- TRPRINT(TR_MSG|TR_TRANS, TR_LEVEL_2, ("signalling master"));
-
- /*
- * signal the master
- */
- SM_ASSERT(LEVEL_3, transRec->masterThread->state == THREAD_TRANS_QUIESCE_WAIT);
- listMoveEnq( &ReadyList, &(transRec->masterThread->controlList) );
- }
-
- } else {
-
- /*
- * null out the transrec pointer
- */
- tcb->transRec = NULL;
- }
- }
-